
<?php

include_once "function_net_bridge.php";
include_once "function_misc.php";
$in_array['Name'] = "br0";
$in_array['Ip'] = $_POST['ip'];
$in_array['Mask']= $_POST['mask'];
$ret_array = GetXmlBridgeInfoByName($in_array['Name']);
$in_array['Ports'] = $ret_array['Ports'];
$in_array['Stp'] = $ret_array['Stp'];
EditXmlNetDevBridge($in_array);

include_once  "function_net_dns.php";
$dns_array = GetXmlDns();
$dns1 = $_POST['dns'];
$dns2 = $dns_array[1];
SetXmlDns($dns1, $dns2);

include_once  "function_net_route.php";
$ret_array = GetXmlStaticRoutes();
$i = 0;
$iflag = 0;
foreach ($ret_array as $gw)
{
	if ($gw['DstIp'] == '0.0.0.0' && $gw['DstMask'] == '0.0.0.0')
	{
		$iflag = 1;
		break;
	}	
	$i ++;
}
if ($iflag)
{
	$in_array["dev"]= $ret_array[$i]['dev'];
	$in_array['DstIp']= $ret_array[$i]['DstIp'];
	$in_array['DstMask'] = $ret_array[$i]['DstMask'];
	$in_array['GateWay'] = $_POST['gw'];
	$in_array['Valid'] = $ret_array[$i]['Valid'];
	EditXmlOneStaticRoutes($i, $in_array);
}
else
{
	$in_array["dev"]= "All";
	$in_array['DstIp']= "0.0.0.0";
	$in_array['DstMask'] = "0.0.0.0";
	$in_array['GateWay'] = $_POST['gw'];
	$in_array['Valid'] = "1";
	AppendXmlOneStaticRoutes($in_array);
}
echo("<meta http-equiv='refresh'content=0;URL='quick_config.php'>");

?>
